<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    // console.log(typeof Promise)
    // console.dir(Promise)
    var p=new Promise(function (resolve, reject) {
        setTimeout(function () {
            var flag=false
            if (flag){
                resolve('hello')
            }else {
                reject('出错了')
            }
        },1000)
    })
    p.then(function (data) {
        console.log(data)
    },function (info) {
        console.log(info)
    })
</script>
</body>
</html>